package com.umgsai.thread.thread36;

import java.io.PipedInputStream;
import java.io.PipedOutputStream;
import java.io.PipedReader;
import java.io.PipedWriter;

public class Main {
	public static void main(String[] args) {
		try {
			WriteData writeData = new WriteData();
			ReadData readData = new ReadData();
			
			PipedReader reader = new PipedReader();
			PipedWriter writer = new PipedWriter();
			
//			writer.connect(reader);
			reader.connect(writer);
			
			ThreadRead threadRead = new ThreadRead(readData, reader);
			ThreadWrite threadWrite = new ThreadWrite(writeData, writer);
			
			threadRead.start();
			
			Thread.sleep(1000);
			
			threadWrite.start();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
